package com.book.common;

import lombok.Data;

/**
 * @version 1.0
 * @Author Jincheng.Li
 * @Date 2021/6/6 7:45 下午
 * @Project_Name graduation-project
 */
@Data
public class CommonResult {
    private Integer code;
    private String msg;

    public CommonResult(Integer code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public static CommonResult getFaiInstance(Integer code,String msg){
        return new CommonResult(code,msg);
    }

    public static CommonResult success(String msg){
        return new CommonResult(200,msg);
    }

    public static CommonResult successNoMsg(){
        return new CommonResult(200,null);
    }

    public static CommonResult fail(String msg){
        return new CommonResult(400,msg);
    }
}
